#ifndef CPP_WATCHVIEW_H
#define CPP_WATCHVIEW_H

#include <widget/View.h>

class Bitmap;
class Timer;

//@brief 时钟控件
//@author cvte
//@description 指针型时钟控件
class WatchView : public View {
   public:
    // constructor & destructor
    WatchView();
    virtual ~WatchView();
    //@method 设置时针图片，图片中心点为旋转点
    void setHourPointerBitmap(Bitmap& bitmap);
    //@method 设置分针图片，图片中心点为旋转点
    void setMinutePointerBitmap(Bitmap& bitmap);
    //@method 设置秒针图片，图片中心点为旋转点
    void setSecondPointerBitmap(Bitmap& bitmap);
    //@method 设置最顶层图片，例如可以设置顶部中心装饰图
    void setTopMostBitmap(Bitmap& bitmap, int x, int y);

   protected:
    void onAttachedToWindow();
    void onDetachedFromWindow();
    void onDraw(Canvas& canvas);

   private:
    Bitmap* mBitmapHourPointer = nullptr;
    Bitmap* mBitmapMinutePointer = nullptr;
    Bitmap* mBitmapSecondPointer = nullptr;
    Bitmap* mBitmapTopMost = nullptr;
    int mBitmapTopMostX = 0;
    int mBitmapTopMostY = 0;

    Timer mTimer;
};

#endif /* CPP_WATCHVIEW_H */